package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppAssetPerformance;
import com.ep.modules.app.service.AppAssetPerformanceService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/asset_performance")
public class AppAssetPerformanceController {
    @Autowired
    private AppAssetPerformanceService appAssetPerformanceService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appAssetPerformanceService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppAssetPerformance appassetperformance = appAssetPerformanceService.getById(id);
        return R.ok().put("appassetperformance", appassetperformance);
    }

    @SysLog("保存AppAssetPerformance")
    @PostMapping("/save")
    public R save(@RequestBody AppAssetPerformance appassetperformance) {
        ValidatorUtils.validateEntity(appassetperformance);
        appAssetPerformanceService.save(appassetperformance);
        return R.ok();
    }

    @SysLog("修改AppAssetPerformance")
    @PostMapping("/update")
    public R update(@RequestBody AppAssetPerformance appassetperformance) {
        ValidatorUtils.validateEntity(appassetperformance);
        appAssetPerformanceService.update(appassetperformance);
        return R.ok();
    }

    @SysLog("删除AppAssetPerformance")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appAssetPerformanceService.deleteBatch(ids);
        return R.ok();
    }
}